<?php
/*
 * @Author: 哲学家乔布斯 <wuyangii@qq.com>
 * @Date: 2022-10-20 21:41:37
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-07 22:37:15
 * @Descripttion: 版本更新手动
 */

namespace app\api\controller\common\v1_0;

class Version extends Common
{

    /**
     * @Author: 哲学家乔布斯 <wuyangii@qq.com>
     * @brief: 
     * @return 
     * @Descripttion: 查看版本更新
     */    
    public function index(){
        $version = request()->param('version');
        $type = request()->param('type');

        $new_version = (new \app\common\model\Version())
                ->field(['id','title','url','content','addtime','type','version','package_name'])
                ->where(['type' => $type])
                ->where('version','>',$version)
                ->append(['url_text','addtime_text'])
                ->hidden(['url','addtime'])
                ->find();

        $equal_version = (new \app\common\model\Version())
        ->field(['id','title','url','content','addtime','type','version','package_name'])
        ->where(['type' => $type])
        ->where('version','=',$version)
        ->append(['url_text','addtime_text'])
        ->hidden(['url','addtime'])
        ->find();
        return self::successResult("成功",[
            'new_version' => $new_version,
            'equal_version' => $equal_version
        ]); 
    }   

}
